home *** CD-ROM | disk | FTP | other *** search
- PROGRAM Turbo_Tester;
-
- { Taken from SoftTalk: July 1984, page 5. }
- { Typed in and modified by Jeff Firestone. }
-
- PROCEDURE Documentation;
- BEGIN
- WRITELN;
- WRITELN('This program tests Turbo Pascal version 2.0 to see whether your version');
- WRITELN('is able to perform mathematics properly. Early shipments of version 2.0');
- WRITELN('contained a major bug in the floating point routines. The bugs only are');
- WRITELN('found on the standard $49.95 version of 2.0. The more expensive 8087 co-');
- WRITELN('processor version of 2.0 performed floating point math flawlessly.');
- WRITELN;
- END;
-
- PROCEDURE DoCalculation;
- VAR
- a,b,c,d,e,f : REAL;
- indx : INTEGER;
- ch : CHAR;
- BEGIN
- a:= 0.0;
- FOR indx:= 1 TO 100 DO
- BEGIN
- a:= a + 1.0;
- b:= (a * a * a);
- c:= (b / a);
- d:= SQRT(c);
- e:= (d - a);
- END;
-
- WRITELN('The result should be e = 0.0000000');
- WRITELN('The result is e = ', e:12:7); WRITELN;
- WRITELN;
- WRITELN('Now we expect f = 1.0000000');
- a:= 2.0; b:= 1.0;
- f:= (a - b);
- WRITELN('The result is f = ',f:12:7);
- WRITELN; WRITELN;
- IF ((e = 0) and (f = 1)) THEN
- WRITELN('Your Turbo Pascal version is OK')
- ELSE
- WRITELN('Your Turbo Pascal version is defective');
- END;
-
-
- BEGIN
- Documentation;
- DoCalculation;
- END.